<!-- 结算记录 -->
<template>
    <div >
        <a-table rowKey="id" :loading="isload" :columns="columns" :data-source="dataList" @change="handleTableChange" :pagination="{ total: total ,showSizeChanger: true,pageSize: size,}" size="small">
            <div slot="state" slot-scope="state">
                <a-tag v-if="state == '0'" color="red">发放失败</a-tag>
                <a-tag v-if="state == '1'" color="green">发放成功</a-tag>
            </div>
        </a-table>
    </div>
</template>

<script>
import { columns } from './table';
import { getLaborSignUserSettlementList } from '@/api/services/member';
export default {
    props: ['realName','idCard'],
    data () {
        return {
            page: 1,
            size: 10,
            total: 0,
            dataList: [],
            isload: false,
            columns,
        };
    },
    created(){
        this.getData();
    },
    methods: {
        // 获取列表数据
        getData(){
            let _this = this;
            _this.isload = true;
            const params = {
                'realName': _this.realName,
                'idCard': _this.idCard,
                'pageIndex': _this.page,
                'pageSize': _this.size,
            }
            getLaborSignUserSettlementList(params)
            .then(res => {
                _this.isload = false;
                if(res.success){
                    _this.dataList = res.data;
                    _this.total = res.totalCount;
                }else{
                    _this.$notification['error']({
                        message: '温馨提示',
                        description: res.errMessage,
                        duration: 8
                    })
                }
            })
        },
        // 分页
        handleTableChange(pagination, filters, sorter) {
            console.log(pagination);
            this.page = pagination.current;
            this.size = pagination.pageSize;
            this.getData()
        },
    }
}

</script>
<style scoped>

</style>